// KeyboardState.cs
//

using System;
using System.Collections.Generic;
using System.Html;
using System.Html.Media.Graphics;

namespace Moonbeam.Input
{
    public class KeyboardState
    {
        List<int> _keys = new List<int>(2);

        public KeyboardState()
        {
            //initialise _keys to false
            resetKeys();
        }

        void resetKeys()
        {
            _keys.Clear();
        }

        #region Internal Methods

        internal void _SetKeys(List<int> keysPressed)
        {
            resetKeys();

            _keys = keysPressed;
        }

        #endregion

        #region public methods

        public bool IsKeyDown(Keys key)
        {
            return _keys.Contains((int)key);
            
        }

        public bool IsKeyUp(Keys key)
        {
            return !_keys.Contains((int)key);
        }

        public Keys[] GetPressedKeys()
        {
             List<Keys> retVal = new List<Keys>();

             foreach (int currentKey in _keys)
             {
                 retVal.Add((Keys)currentKey);
             }

            return (Keys[])retVal;
        }

        #endregion
    }
}
